<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>送货单预览</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
		.table {
		    width: 100%;
		    margin-bottom: 0px;
		}
		.table td {
			vertical-align: middle;
			text-align: center;
			padding: 0px;
			margin: 0px;
			height: 30px;
		}
		.top_table td {
			vertical-align: middle;
			text-align: left;
			padding: 0px;
			margin: 0px;
			height: 30px;
			border: 0px;
		}
		.bottom_line{
			border-bottom: 2px solid;
		}
		.center{
			text-align: center;
		}
		.footer {
			position:fixed; bottom:0; background:#ABABAB; width:100%; height:35px; line-height:32px; z-index:9999; opacity:.90;
			filter:alpha(opacity=60); _bottom:auto; _width:100%; _position:absolute;text-align: right;
			_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-
			(parseInt(this.currentStyle.marginTop, 10)||0)-(parseInt(this.currentStyle.marginBottom, 10)||0)));
	    }
	    .table-condensed th, .table-condensed td {
		    padding: 0px;
		}
	</style>
	<script type="text/javascript">
		var isIE = false;
		$(document).ready(function() {
			var nodeLen = $(".jbox-button-panel", top.document).length;
			$(".jbox-button-panel", top.document).eq(nodeLen-1).remove();
			//判断浏览器类型
			if(navigator.userAgent.indexOf("MSIE")>0) {  
				isIE = true;
			}
		});
		//打印
		function printDetail(){
			try{
				var WSc=new ActiveXObject("WScript.Shell"); 
				HKEY_Key="header"; 
				WSc.RegWrite(HKEY_RootPath+HKEY_Key,""); 
				HKEY_Key="footer"; 
				WSc.RegWrite(HKEY_RootPath+HKEY_Key,"");
			}catch(e){}
			$("#printDiv").hide();
			window.print();
			$("#printDiv").show();
		}
		//导出word
		function exportWord(id){
			$.ajax({
				type: 'post',
				url: '${ctx}/ivm/order/exportWord',
				data: 'orderIds='+id,
				dataType: 'json',
				success: function(data){
					if(data.status==200){
						document.location.href= '${ctx}/download?filePath='+URLencode(data.message);
					}else{
						showJBoxMess(data.message,"error");
					}
				},
				failure: function(){
					showJBoxMess("操作失败","error");
				}
			});
		}
	</script>
</head>
<body>
	<!--startprint-->
	<div style="margin:10px 50px 50px 50px" id="PrintA">
		<!-- 送货单 -->
		<table class="table top_table" width="100%" style="margin-bottom: 20px;">
			<tr class="bottom_line">
				<td>
					<img src="${ctxFront }/images/print_logo.png" height="85" width="85" style="padding-bottom: 20px;">
				</td>
				<td colspan="3" style="text-align: right;vertical-align: bottom;padding-bottom: 10px;">
					<span style="font-size: 22px;"><strong>派送单</strong></span>
					<span>客户联</span>
					<span style="padding-left: 33%;">${order.deliveryNo }</span>
				</td>
			</tr>
			<tr>
				<td width="13%">收货人：</td>
				<td width="37%">${deliveryInfo.name}</td>
				<td width="13%">收货地址：</td>
				<td width="37%">${deliveryInfo.address}</td>
			</tr>
			<tr class="bottom_line">
				<td>联系电话：</td>
				<td>${deliveryInfo.phone}</td>
				<td>收货时间：</td>
				<td>${deliveryInfo.timeText}</td>
			</tr>
		</table>
		<table class="table-condensed center" border="1" width="100%">
			<tr>
				<th width="20%">支付状态</th>
				<th width="25%">
					<c:if test="${order.payType== '1'}">应收金额</c:if>
					<c:if test="${order.payType!= '1'}">应退金额</c:if>
				</th>
				<th width="55%">特殊状态标识</th>
			</tr>
			<tr>
				<td>
					<c:if test="${order.payType== '1'}">到付</c:if>
					<c:if test="${order.payType!= '1'}">网付</c:if>
				</td>
				<td>
					<c:if test="${order.payType== '1'}"><label class="total-amount">${deliveryInfo.amount }</label></c:if>
					<c:if test="${order.payType!= '1'}"><label class="total-refund">${deliveryInfo.refund }</label></c:if>
				</td>
				<td>${deliveryInfo.specialMark }</td>
			</tr>
		</table>
		<p style="padding-top: 20px;" class="bottom_line"></p>
		<!-- 送货单信息 -->
		<table class="table-condensed center" border="1" width="100%" style="margin-top: 20px;">
			<thead>
				<tr>
					<th>商品名细</th>
					<th style="width:17%">规格</th>
					<th style="width:17%">数量</th>
					<th style="width:17%">单价</th>
					<th style="width:17%">小计</th>
				</tr>
			</thead>
			<tbody class="details">
				<c:forEach items="${order.deliveryList}" var="deliveryDetail">
				<tr>
					<td>${deliveryDetail.product.name }</td>
					<td>${deliveryDetail.product.assisTitle }</td>
					<td>${deliveryDetail.number}</td>
					<td>${deliveryDetail.price}</td>
					<td>${deliveryDetail.amount }</td>
				</tr>
				</c:forEach>
			</tbody>
			<tr>
				<td colspan="4" style="text-align: right;border-left: 1px solid white;;border-bottom: 1px solid white;">总计：</td><td>${deliveryInfo.amount } 元</td>
			</tr>
		</table>
		<!-- 温馨提示 -->
		<table class="table top_table" width="100%">
			<tr>
				<td>温馨提示：<br/>${deliveryInfo.prompt }</td>
			</tr>
		</table>
		<!-- 派送单回单联 -->
		<table class="table-condensed center" width="100%" style="margin-top: 30px;">
			<tr>
				<td colspan="4" style="text-align: center;">
					<img src="${ctxFront }/images/dashed.png" height="15" width="100%">
				</td>
			</tr>
			<tr>
				<td colspan="4" style="text-align: right;height: 35px;">
					<span style="font-size: 22px;"><strong>派送单</strong></span>
					<span>回单联</span>
					<span style="padding-left: 30%;">${order.deliveryNo }</span>
				</td>
			</tr>
		</table>
		<table class="table-condensed" width="100%" border="1">
			<tr>
				<td style="width:12%;text-align: center;">客户姓名</td>
				<td style="width:21%">&nbsp;${deliveryInfo.name}</td>
				<td style="width:12%;text-align: center;">联系电话</td>
				<td style="width:15%" colspan="2">&nbsp;${deliveryInfo.phone }</td>
				<td style="width:11%;text-align: center;">是否面收</td>
				<td style="width:11%"></td>
			</tr>
			<tr>
				<td rowspan="2" style="text-align: center;">收货地址</td>
				<td rowspan="2" colspan="2">&nbsp;${deliveryInfo.address}</td>
				<td style="text-align: center;">要求送达时间</td>
				<td style="width:18%">&nbsp;${deliveryInfo.timeText}</td>
				<td style="text-align: center;">
					<c:if test="${order.payType== '1'}">应收金额</c:if>
					<c:if test="${order.payType!= '1'}">应退金额</c:if>
				</td>
				<td>&nbsp;
					<c:if test="${order.payType== '1'}"><label class="total-amount2">${deliveryInfo.amount }</label></c:if>
					<c:if test="${order.payType!= '1'}"><label class="total-refund2">${deliveryInfo.refund }</label></c:if> 元
				</td>
			</tr>
			<tr>
				<td style="text-align: center;">实际送达时间</td>
				<td></td>
				<td style="text-align: center;">
					<c:if test="${order.payType== '1'}">实收金额</c:if>
					<c:if test="${order.payType!= '1'}">实退金额</c:if>
				</td>
				<td></td>
			</tr>
			<tr height="52px">
				<td style="text-align: center;">送货备注</td>
				<td colspan="2">&nbsp;${order.remarks }</td>
				<td style="text-align: center;">客户签字</td>
				<td colspan="3"></td>
			</tr>
		</table>
	</div>
	<!--endprint-->
	<div class="footer" id="printDiv">
		<input value="打印" type="button" class="btn btn-primary" style="margin-right: 20px;" onclick="printDetail()"/>
		<!-- <input value="导出Word" type="button" class="btn btn-primary" style="margin-right: 20px;" onclick="exportWord('${order.id}')"/> -->
	</div>
</body>
</html>